package com.hankol.newretail.viewmodel

import androidx.databinding.ObservableField
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.baselibrary.base.BasicListBean
import com.baselibrary.base.mvvm.BaseViewModel
import com.baselibrary.bean.WxPaySignBean
import com.hankol.newretail.bean.GoodListBean
import com.hankol.newretail.bean.MyOrderBean
import com.hankol.newretail.bean.PayResultBean
import com.hankol.newretail.respository.NewReatilRequestManager

/*支付 选择方式*/
class SelectPayStyleViewModel : BaseViewModel() {
    var isSelectWeChat = ObservableField<Boolean>(true)
    var creatPayWX: MutableLiveData<Long> = MutableLiveData()
    var creatPayZFB: MutableLiveData<Long> = MutableLiveData()
    var pay4WX: MutableLiveData<WxPaySignBean> = MutableLiveData()
    var pay4ZFB: MutableLiveData<String> = MutableLiveData()

    //待付款超时
    var overTimeCancelLD: MutableLiveData<Any> = MutableLiveData()
    //猜你喜欢 商品  分页列表
    var guessYouLikeLD: MutableLiveData<BasicListBean<GoodListBean>> = MutableLiveData()

    fun requestData() {
    }

    //微信_电商订单_生成支付订单_v2
    fun createPayOrder4wx(poids: String) {
        NewReatilRequestManager.getInstance().createPayOrder4wx(creatPayWX, poids)
    }

    //支付宝_电商订单_生成支付订单_v2
    fun createPayOrder4zfb(poids: String) {
        NewReatilRequestManager.getInstance().createPayOrder4zfb(creatPayZFB, poids)
    }

    //微信支付
    fun requestPay4WX(oid: Long) {
        NewReatilRequestManager.getInstance().requestPay4WX(pay4WX, oid)
    }

    //支付宝支付
    fun requestPay4ZFB(oid: Long) {
        NewReatilRequestManager.getInstance().requestPay4ZFB(pay4ZFB, oid)
    }

    var payIsSuccLD: MutableLiveData<PayResultBean> = MutableLiveData()

    //微信支付宝查询订单是否支付成功
    fun requestPayIsSucc(oid: String) {
        NewReatilRequestManager.getInstance().requestPayIsSucc(payIsSuccLD, oid)
    }

    /**
     *猜你喜欢 商品  分页列表
     */
    fun reqGuessYouLikeGoodList(ids: String, page: Int) {
        NewReatilRequestManager.getInstance().reqRecommendGoods(guessYouLikeLD, ids, 2, 0,page, 20)
    }

    //客户端关闭未支付超时订单
    fun requestOverTimeNoPayCancel(poId: String) {
        NewReatilRequestManager.getInstance().requestOverTimeNoPayCancel(overTimeCancelLD, poId)
    }

}